package cn.xiaomubiao.oschine.adapter.myinfo;

import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.TextView;

import cn.xiaomubiao.oschine.R;
import cn.xiaomubiao.oschine.bean.Blog;
import cn.xiaomubiao.oschine.util.StringUtils;
import cn.xiaomubiao.oschine.util.UIUtils;

/**
 * @author
 * @version 1.0
 * @date 2017/4/7
 */

public class MyInfoBlogAdapter extends  MyInfoBaseListAdapter<Blog>{
    
        @Override
        protected void initItemView(View itemView, int position) {
            TextView textView1 = (TextView) itemView.findViewById(R.id.title);
            textView1.setText(datas.get(position).getTitle());
            Drawable img = UIUtils.getContext().getResources().getDrawable(R.drawable.widget_original_icon);
            // 调用setCompoundDrawables时，
            // 必须调用Drawable.setBounds()方法,否则图片不显示
            img.setBounds(0, 0, img.getMinimumWidth(), img.getMinimumHeight());
            textView1.setCompoundDrawables(img,null,null,null);
            TextView textView2 = (TextView) itemView.findViewById(R.id.content);
            textView2.setHeight(0);
            TextView textView5 = (TextView) itemView.findViewById(R.id.name);
            textView5.setText(datas.get(position).getAuthor());
            TextView textView3 = (TextView) itemView.findViewById(R.id.time);
            textView3.setText(StringUtils.friendly_time(datas.get(position).getPubDate()));
            TextView textView4 = (TextView) itemView.findViewById(R.id.siez);
            textView4.setText("0");
        }
        
        @Override
        public int getLayoutId() {
            return R.layout.news_adapter_title;
        }
    
}
